{include file="public/head"}
<style>
    .x-body {
        min-width: 900px;
    }

    body {
        overflow-x: scroll;
    }
</style>
<body>
<div class="x-body">
    <div class="lotus-nav">
        <span>共有数据:<i class="i_count">{if count($list)>0}{$list->total()}{else/}0{/if}</i>条
        <button onclick="javascript:location.reload()" class="layui-btn-default ">
            <i class="layui-icon layui-icon-refresh"></i>
        </button>
        </span>
    </div>


    <table class="layui-table">
        <thead>
        <tr>
            <th style="width: 20px;text-align: center"></th>
            <th style="width: 70px;text-align:center">运费金额</th>
            <td style="width: 85px;text-align:center">商品图片</td>
            <th style="width: 150px;text-align:center">提交用户</th>
            <th style="width: 150px;text-align:center">提交公司</th>
            <th style="width: 120px;text-align:center">创建时间</th>
            <th style="width: 130px;text-align:center">操作</th>
        </thead>
        <tbody>
        {if count($list)>0}
        {volist name="list" id="vo"}
        <tr>
            <td style="text-align:center">{$i}</td>
            <td style="text-align:center">￥{$vo.money}</td>
            <td>
                {if isset($product[$vo['detail_id']]['url']) && !empty($product[$vo['detail_id']]['url'])}
                <img src="{$product[$vo['detail_id']]['url']}" onclick="previewImg(this)">
                {else/}
                <img src="__images__/noimg.png">
                {/if}
            </td>
            <td style="text-align:center">{$vo.operate_truename}</td>
            <td style="text-align:center">{$company[$vo['company_id']]['name']|default=''}</td>
            <td style="text-align:center">{$vo['timestamp']|date="Y-m-d H:i",###}</td>
            <td style="text-align:center">
                <button class="layui-btn layui-btn-xs"
                        onclick="x_admin_show('详情','waybillInfo.html?id={$vo.id}')">详情
                </button>

                <button onclick="audit(this,'{$vo.id}',2)"
                        class="layui-btn layui-btn-xs layui-btn-normal">
                    审核
                </button>

                <button onclick="audit(this,'{$vo.id}',3)"
                        class="layui-btn layui-btn-xs layui-btn-warm">
                    拒绝
                </button>
            </td>
        </tr>
        {/volist}
        {else/}
        <tr>
            <td style="text-align: center;color:red" colspan="9">未找到符合条件的结果</td>
        </tr>
        {/if}
        </tbody>
    </table>
    {if count($list)>0}
    <div class="page">
        <div>
            {$list->render()}
        </div>
    </div>
    {/if}
</div>
</body>
{include file="public/foot"}
<script>
    function audit(obj, id, type) {
        var info = type == 2 ? "审核通过" : "拒绝";
        layer.confirm('确认' + info + '？', function (index) {
            $.post("{:url('admin/wallet/auditWaybill')}", {
                id: id,
                audit: type
            }, function (data, textStatus, xhr) {
                if (data.code == 1) {
                    layer.msg(data.msg, {icon: 1, time: 1000});
                    location.reload();
                } else {
                    layer.msg(data.msg, {icon: 2, time: 1000});
                }

            });
        });
    }
    function p_admin_show(title,url){
        parent.layer.open({
            type: 2,
            area: ['90%', '90%'],
            fix: false, //不固定
            maxmin: true,
            shadeClose: false,//是否点击遮罩关闭弹窗
            shade:0.2,
            resize:true,
            title: title,
            content: url
        });
    }
</script>
